Imports FileAcl = VirtualDesk.FileACL
Public Class TestForm
    Dim path As String = "C:\Documents and Settings\u0123800\My Documents\Visual Studio 2005\Projects\VirtualDesk\VirtualDesk\bin\Test"
    Dim filepath As String = "C:\Documents and Settings\u0123800\My Documents\Visual Studio 2005\Projects\VirtualDesk\VirtualDesk\bin\VirtualDesk.exe.config"

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If FileACL.AddDirectorySecurity(path, "Users", _
              Security.AccessControl.FileSystemRights.FullControl, _
              Security.AccessControl.AccessControlType.Allow) = True Then
            MsgBox("Sucessfully Set Permission")
        Else
            MsgBox("Set Permission Faild")
        End If
        ''VirtualDesk.exe.config
        If FileACL.AddFileSecurity(filepath, "Users", _
                   Security.AccessControl.FileSystemRights.FullControl, _
                   Security.AccessControl.AccessControlType.Allow) = True Then
            MsgBox("Sucessfully Set Permission")
        Else
            MsgBox("Set Permission Faild")
        End If


    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        If FileACL.RemoveDirectorySecurity(path, "Users", _
               Security.AccessControl.FileSystemRights.FullControl, _
               Security.AccessControl.AccessControlType.Deny) = True Then
            MsgBox("Sucessfully Set Permission")
        Else
            MsgBox("Set Permission Faild")
        End If
        If FileACL.RemoveFileSecurity(filepath, "Users", _
           Security.AccessControl.FileSystemRights.FullControl, _
           Security.AccessControl.AccessControlType.Deny) = True Then
            MsgBox("Sucessfully Set Permission")
        Else
            MsgBox("Set Permission Faild")
        End If
    End Sub
End Class